// 解析类型
export enum A_RESOLVE_TYPE {
  NONE = 0,
  RESOLVED,
  UNRESOLVED
}

export const resolveStatusOptions = [
  {
    label: '未接入',
    value: A_RESOLVE_TYPE.NONE
  },
  {
    label: '已接入',
    value: A_RESOLVE_TYPE.RESOLVED
  },
  { label: '未接入', value: A_RESOLVE_TYPE.UNRESOLVED }
]
// http状态
export enum A_HTTPS_TYPE {
  OPEN = 1,
  UNOPENED
}

export const httpsStatusOptions = [
  { label: '已开启', value: A_HTTPS_TYPE.OPEN },
  { label: '未开启', value: A_HTTPS_TYPE.UNOPENED }
]
// 协议
export enum E_PROTOCOL {
  HTTP = 'http',
  HTTPS = 'https'
}

export const protocolOptions: LabelValue[] = [
  { label: 'HTTP', value: E_PROTOCOL.HTTP },
  { label: 'HTTPS', value: E_PROTOCOL.HTTPS }
]
// 优先类型
export enum A_PRIORITY_TYPE {
  WEIGHT = 'swrr',
  POLLING = 'round_robin',
  HASH = 'chash'
}

export const priorityTypeOptions: LabelValue[] = [
  { label: '权重', value: A_PRIORITY_TYPE.WEIGHT },
  { label: '轮询', value: A_PRIORITY_TYPE.POLLING },
  { label: '哈希', value: A_PRIORITY_TYPE.HASH }
]
// 缓存时间
export enum A_CACHE_TIME {
  DAY = 'd',
  HOUR = 'h',
  MINUTE = 'm',
  SECOND = 's'
}
export const cacheTimeOptions: LabelValue[] = [
  { label: '天', value: A_CACHE_TIME.DAY },
  { label: '小时', value: A_CACHE_TIME.HOUR },
  { label: '分钟', value: A_CACHE_TIME.MINUTE },
  { label: '秒', value: A_CACHE_TIME.SECOND }
]
// 缓存时间
export enum A_COMPRESS_TYPE {
  JS = 'js',
  CSS = 'css',
  HTML = 'html'
}
export const compressOptions: LabelValue[] = [
  { label: 'JS', value: A_COMPRESS_TYPE.JS },
  { label: 'CSS', value: A_COMPRESS_TYPE.CSS },
  { label: 'HTML', value: A_COMPRESS_TYPE.HTML }
]
// 执行策略
export enum A_EXECUTION_TYPE {
  PREVENT = 1,
  SKIP,
  OBSERVE
}
export const executionOptions: LabelValue[] = [
  { label: '阻止', value: A_EXECUTION_TYPE.PREVENT },
  { label: '观察', value: A_EXECUTION_TYPE.OBSERVE }
]
export enum A_EXECUTION_PRIORITY {
  LAST = 0,
  FIRST = 1,
  CUSTOM
}
//执行优先级
export const priorityOptions = [
  {
    value: A_EXECUTION_PRIORITY.FIRST,
    label: '第一个'
  },
  {
    value: A_EXECUTION_PRIORITY.LAST,
    label: '最后一个'
  },
  {
    value: A_EXECUTION_PRIORITY.CUSTOM,
    label: '自定义'
  }
]
export enum A_RULE_TYPE {
  REWRITE_URL = 1,
  REQUEST_HEADER,
  RESPONSE_HEADER
}
//执行优先级
export const ruleTypeOptions = [
  {
    value: A_RULE_TYPE.REWRITE_URL,
    label: 'URL 重写'
  },
  {
    value: A_RULE_TYPE.REQUEST_HEADER,
    label: 'HTTP 请求头修改'
  },
  {
    value: A_RULE_TYPE.RESPONSE_HEADER,
    label: 'HTTP 响应头修改'
  }
]
export enum LICENSE_SOURCE {
  MANUAL = 1,
  SYSTEM
}
export enum LICENSE_BRAND {
  LETS_ENCRYPT = 1,
  ZERO_SSL
}
export enum LICENSE_APPLY_STATUS {
  UNKNOWN = 0,
  NORMAL = 1,
  FAILED,
  APPLYING
}
export enum LICENSE_ALGORITHM {
  EC256 = 1,
  EC384,
  RSA2048,
  RSA3072,
  RSA4096
}
export const LicenseSourceOptions = [
  {
    label: '手动上传',
    value: LICENSE_SOURCE.MANUAL
  },
  {
    label: '系统托管',
    value: LICENSE_SOURCE.SYSTEM
  }
]

export const LicenseBrandOptions = [
  {
    label: "Let's Encrypt",
    value: LICENSE_BRAND.LETS_ENCRYPT
  },
  {
    label: 'ZeroSSL',
    value: LICENSE_BRAND.ZERO_SSL
  }
]
export const LicenseAlgorithmOptions = [
  {
    label: 'EC256',
    value: LICENSE_ALGORITHM.EC256
  },
  {
    label: 'EC384',
    value: LICENSE_ALGORITHM.EC384
  },
  {
    label: 'RSA2048',
    value: LICENSE_ALGORITHM.RSA2048
  },
  {
    label: 'RSA3072',
    value: LICENSE_ALGORITHM.RSA3072
  },
  {
    label: 'RSA4096',
    value: LICENSE_ALGORITHM.RSA4096
  }
]
export enum A_RESPONSE_TYPE {
  DEFAULT = 1,
  CUSTOM_HTML,
  CUSTOM_TEXT,
  CUSTOM_JSON,
  CUSTOM_XML
}
export const RESPONSE_TYPE_LIST = [
  {
    value: A_RESPONSE_TYPE.DEFAULT,
    label: 'WAF 阻止错误页'
  },
  {
    value: A_RESPONSE_TYPE.CUSTOM_HTML,
    label: '自定义 HTML'
  },
  {
    value: A_RESPONSE_TYPE.CUSTOM_TEXT,
    label: '自定义文本'
  },
  {
    value: A_RESPONSE_TYPE.CUSTOM_JSON,
    label: '自定义 JSON'
  },
  {
    value: A_RESPONSE_TYPE.CUSTOM_XML,
    label: '自定义 XML'
  }
]
export const licenseApplyResultOptions = [
  {
    label: '正常',
    value: LICENSE_APPLY_STATUS.NORMAL
  },
  {
    label: '失败',
    value: LICENSE_APPLY_STATUS.FAILED
  },
  {
    label: '申请中',
    value: LICENSE_APPLY_STATUS.APPLYING
  }
]
export enum A_SKIP_MODULE_TYPE {
  CUSTOM_RULE = 1,
  RATE_LIMIT
}
//跳过模块
export const skipModuleOptions = [
  {
    value: A_SKIP_MODULE_TYPE.CUSTOM_RULE,
    label: '自定义规则'
  },
  {
    value: A_SKIP_MODULE_TYPE.RATE_LIMIT,
    label: '速率限制'
  }
]

export enum SITE_RESOLVE_STATUS {
  PROCESSING = 1,
  SUCCESS = 2,
  FAILED = 3,
  PAUSED = 4
}

export const siteResolveStatusOptions = [
  {
    label: '正在处理',
    value: SITE_RESOLVE_STATUS.PROCESSING
  },
  {
    label: '处理成功',
    value: SITE_RESOLVE_STATUS.SUCCESS
  },
  {
    label: '处理失败',
    value: SITE_RESOLVE_STATUS.FAILED
  },
  {
    label: '暂停解析',
    value: SITE_RESOLVE_STATUS.PAUSED
  }
]
